#ifndef COLLISION1D_EXCITATION_H
#define COLLISION1D_EXCITATION_H

#include <vector>

#include "../Tool/Macros.h"
#include "../Input/PicParams.h"
#include "../Species/Species.h"
#include "Collision1D.h"

class Collision1D_Excitation : public Collision1D
{

public:

    Collision1D_Excitation(PicParams* params_, CollisionParameter collision_param_, int collision_number_);

    ~Collision1D_Excitation();

    void collide(PhysicalField* fields, vector<Species*>& vecSpecies, Diagnostic* diag, int itime);

    //get the maximum value of crossSection*velocity
    inline double max_cv(Species1D* s1)
    {
        double v_square;
        double v_magnitude;
        double ke;
        double maxCrossSectionV = 0.0;
        double crossSectionV;

        maxCrossSectionV = 0.0;
        for(auto cell_particles : s1->particles_)
        {
            for(auto& particle : cell_particles->data_)
            {
                v_square = particle.velocity[0] * particle.velocity[0] +
                           particle.velocity[1] * particle.velocity[1] +
                           particle.velocity[2] * particle.velocity[2] ;
                v_magnitude = sqrt(v_square);

                //ke is energy (eV)
                ke = 0.5 * s1->species_param.mass * v_square / params->const_e;
                crossSectionV = v_magnitude * interplate_cross_section( ke );
                if(crossSectionV > maxCrossSectionV) { maxCrossSectionV = crossSectionV; }
            }

        }
        return maxCrossSectionV;
    };


private:

    //the ionization threshold energy
    double energy_threshold;
};


#endif
